# JellyBeanColourCounter.py # # Description: This program takes an image as input and outputs # the percentage of each jellybean colour in the image. # # Author: AL and AL # Date: March 2024 # Import image processing libraries from PIL import Image # Define a function to detect yellow pixels def isPixelYellow(R, G, B): ''' Returns True if the given pixel is yellow, otherwise False.''' return R > 150 and G > 150 and B < 100 # ***Main part of the program # Open an image of jellybeans and load its bitmap # Print the value of the topmost pixel -> yellow? # Test my function to make sure it detects yellow pixel correctly # Close the file beansOpen.close()